import { Component, Input, OnChanges, OnDestroy } from '@angular/core';

import { BrandHistoryService } from './brand.history.service';

import { Util } from '../../../../utils/util';



@Component({
  selector: 'brand-history',
  templateUrl: './brand.history.html',
  providers: [BrandHistoryService]
})

export class BrandHistoryComponent {

  @Input() date: any;
  brandInfo: any;
  eventOff: any;
  constructor(private service: BrandHistoryService, private util: Util) {

    this.brandInfo = this.util.sessionStore().get('brandDetail');

  }

  vm = {
    "loading": true,
    "data": [],
    "column": {
      fileName: '',
      dim: ['date', 'categoryId', 'brandName', 'sellMoney', 'sellAmount', 'monthSellMoney', 'monthSellAmount', 'productNum', 'shopNum', 'tsellMoney', 'tsellAmount', 'monthTSellMoney', 'monthTSellAmount', 'tproductNum', 'tshopNum', 'thksellMoney', 'thksellAmount', 'monthThkSellMoney', 'monthThkSellAmount', 'thkproductNum', 'thkshopNum', 'gsellMoney', 'gsellAmount', 'monthGSellMoney', 'monthGSellAmount', 'gproductNum', 'gshopNum', 'csellMoney', 'csellAmount', 'monthCSellMoney', 'monthCSellAmount', 'cproductNum', 'cshopNum'],
      dimText: ['时间', '类目id', '品牌名', '日销售额', '日销售量', '近30天销售额', '近30天销售量', '动销宝贝数', '动销店铺数', '天猫日销售额', '天猫日销售量', '天猫近30天销售额', '天猫近30天销售量', '天猫宝贝数', '天猫店铺数', '天猫国际日销售额', '天猫国际日销售量', '天猫国际近30天销售额', '天猫国际近30天销售量', '天猫国际宝贝数', '天猫国际店铺数', '全球购日销售额', '全球购日销售量', '全球购近30天销售额', '全球购近30天销售量', '全球购宝贝数', '全球购店铺数', '淘宝日销售额', '淘宝日销售量', '淘宝近30天销售额', '淘宝近30天销售量', '淘宝宝贝数', '淘宝店铺数']
    },
    "type": 'line-mm'
  };

  columns = ['时间', '日销售量', '日销售额', '近30天销售量', '近30天销售额', '动销店铺数', '动销宝贝数'];

  ngOnChanges(changes) {

    console.log(changes);

    if (changes.date.currentValue && changes.date.currentValue.timeType == 'day') {

      console.log(this.date);
      this.vm.loading = true;
      this.getHttp(this.brandInfo, this.date.date);
    }

  }

  ngOnDestroy() {
    if (this.offEvent) {
      this.offEvent.unsubscribe();
    }


    if (this.eventOff) {
      this.eventOff.unsubscribe();
    }
  }

  export() {
    console.log("export");

    let data = this.util.jsonToArrry(this.vm.data, this.vm.column.dim, this.vm.column.dimText);

    this.util.export(data, this.vm.column.fileName);
  }


  sellResulet: any = {};
  offEvent: any;
  getHttp(brandInfo, date) {

    if (this.vm.loading && this.offEvent) {
      this.offEvent.unsubscribe();
    }

    let json = {
      brandName: "'" + brandInfo.brandName + "'",
      categoryId: brandInfo.categoryId || brandInfo.category
    };

    Object.assign(json, date);
    // console.log(json);
    this.vm.column.fileName = date.begin.slice(0, 10) + '~' + date.end.slice(0, 10) + this.brandInfo.brandName;

    this.sellResulet = {
      'sellMoney': 0,
      'sellAmount': 0
    };

    var res = { "code": 0, "msg": "成功", "data": [{ "id": "-1\u00012017-11-06 00:00:00\u0001new balance", "date": "2017-11-06 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2868, "tsellAmount": 1256, "csellAmount": 1445, "thksellAmount": 23, "gsellAmount": 144, "monthSellAmount": 388919, "monthTSellAmount": 328495, "monthCSellAmount": 54289, "monthThkSellAmount": 754, "monthGSellAmount": 5381, "sellMoney": 981281.56, "tsellMoney": 182915.6, "csellMoney": 721763.96, "thksellMoney": 8232.0, "gsellMoney": 68370.0, "monthSellMoney": 1.3224258375E8, "monthTSellMoney": 1.0404773966E8, "monthCSellMoney": 2.524112506E7, "monthThkSellMoney": 415998.11, "monthGSellMoney": 2537720.92, "productNum": 11389, "tproductNum": 2195, "cproductNum": 8114, "thkproductNum": 181, "gproductNum": 899, "shopNum": 1047, "tshopNum": 41, "cshopNum": 811, "thkshopNum": 15, "gshopNum": 180 }, { "id": "-1\u00012017-11-07 00:00:00\u0001new balance", "date": "2017-11-07 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2058, "tsellAmount": 846, "csellAmount": 1056, "thksellAmount": 16, "gsellAmount": 140, "monthSellAmount": 362608, "monthTSellAmount": 311547, "monthCSellAmount": 45652, "monthThkSellAmount": 714, "monthGSellAmount": 4695, "sellMoney": 761748.92, "tsellMoney": 187737.5, "csellMoney": 501280.64, "thksellMoney": 7669.6, "gsellMoney": 65061.18, "monthSellMoney": 1.4069856848E8, "monthTSellMoney": 1.1714855434E8, "monthCSellMoney": 2.089685132E7, "monthThkSellMoney": 413570.18, "monthGSellMoney": 2239592.64, "productNum": 9743, "tproductNum": 1799, "cproductNum": 6920, "thkproductNum": 175, "gproductNum": 849, "shopNum": 954, "tshopNum": 36, "cshopNum": 734, "thkshopNum": 14, "gshopNum": 170 }, { "id": "-1\u00012017-11-08 00:00:00\u0001new balance", "date": "2017-11-08 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 591, "tsellAmount": 81, "csellAmount": 453, "thksellAmount": 9, "gsellAmount": 48, "monthSellAmount": 39023, "monthTSellAmount": 12301, "monthCSellAmount": 23613, "monthThkSellAmount": 443, "monthGSellAmount": 2666, "sellMoney": 300575.79, "tsellMoney": 46501.0, "csellMoney": 228924.79, "thksellMoney": 5633.0, "gsellMoney": 19517.0, "monthSellMoney": 1.992272785E7, "monthTSellMoney": 7571873.0, "monthCSellMoney": 1.093196461E7, "monthThkSellMoney": 311679.85, "monthGSellMoney": 1107210.39, "productNum": 6200, "tproductNum": 1012, "cproductNum": 4407, "thkproductNum": 138, "gproductNum": 643, "shopNum": 770, "tshopNum": 23, "cshopNum": 601, "thkshopNum": 10, "gshopNum": 136 }, { "id": "-1\u00012017-11-09 00:00:00\u0001new balance", "date": "2017-11-09 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2436, "tsellAmount": 1128, "csellAmount": 1179, "thksellAmount": 12, "gsellAmount": 117, "monthSellAmount": 98975, "monthTSellAmount": 45631, "monthCSellAmount": 48019, "monthThkSellAmount": 560, "monthGSellAmount": 4765, "sellMoney": 329205.18, "tsellMoney": 56341.0, "csellMoney": 240948.2, "thksellMoney": 4828.98, "gsellMoney": 27087.0, "monthSellMoney": 1.956776864E7, "monthTSellMoney": 7480210.4, "monthCSellMoney": 1.061037851E7, "monthThkSellMoney": 300994.34, "monthGSellMoney": 1176185.39, "productNum": 10610, "tproductNum": 2035, "cproductNum": 7542, "thkproductNum": 173, "gproductNum": 860, "shopNum": 1021, "tshopNum": 40, "cshopNum": 790, "thkshopNum": 15, "gshopNum": 176 }, { "id": "-1\u00012017-11-10 00:00:00\u0001new balance", "date": "2017-11-10 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 6718, "tsellAmount": 997, "csellAmount": 4246, "thksellAmount": 878, "gsellAmount": 597, "monthSellAmount": 962046, "monthTSellAmount": 902133, "monthCSellAmount": 51789, "monthThkSellAmount": 2514, "monthGSellAmount": 5610, "sellMoney": 3289770.29, "tsellMoney": 300833.6, "csellMoney": 2260735.48, "thksellMoney": 460345.0, "gsellMoney": 267856.21, "monthSellMoney": 2.881751306E8, "monthTSellMoney": 2.6017526171E8, "monthCSellMoney": 2.398560818E7, "monthThkSellMoney": 1307118.48, "monthGSellMoney": 2707142.23, "productNum": 10977, "tproductNum": 2099, "cproductNum": 7863, "thkproductNum": 166, "gproductNum": 849, "shopNum": 1028, "tshopNum": 40, "cshopNum": 801, "thkshopNum": 15, "gshopNum": 172 }, { "id": "-1\u00012017-11-11 00:00:00\u0001new balance", "date": "2017-11-11 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 840330, "tsellAmount": 833443, "csellAmount": 5369, "thksellAmount": 865, "gsellAmount": 653, "monthSellAmount": 1062177, "monthTSellAmount": 1003702, "monthCSellAmount": 51052, "monthThkSellAmount": 1902, "monthGSellAmount": 5521, "sellMoney": 2.4376576103E8, "tsellMoney": 2.399803955E8, "csellMoney": 2944833.24, "thksellMoney": 532734.0, "gsellMoney": 307798.29, "monthSellMoney": 3.279780111E8, "monthTSellMoney": 3.0065589271E8, "monthCSellMoney": 2.358599268E7, "monthThkSellMoney": 1064329.48, "monthGSellMoney": 2671796.23, "productNum": 10745, "tproductNum": 2002, "cproductNum": 7772, "thkproductNum": 147, "gproductNum": 824, "shopNum": 1017, "tshopNum": 38, "cshopNum": 793, "thkshopNum": 14, "gshopNum": 172 }, { "id": "-1\u00012017-11-12 00:00:00\u0001new balance", "date": "2017-11-12 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 150315, "tsellAmount": 133859, "csellAmount": 13929, "thksellAmount": 1303, "gsellAmount": 1224, "monthSellAmount": 1060780, "monthTSellAmount": 1003475, "monthCSellAmount": 49974, "monthThkSellAmount": 1811, "monthGSellAmount": 5520, "sellMoney": 4.845395221E7, "tsellMoney": 4.01806406E7, "csellMoney": 6999488.04, "thksellMoney": 674469.2, "gsellMoney": 599354.37, "monthSellMoney": 3.2736583377E8, "monthTSellMoney": 3.0057976571E8, "monthCSellMoney": 2.308744535E7, "monthThkSellMoney": 1031860.48, "monthGSellMoney": 2666762.23, "productNum": 10646, "tproductNum": 1995, "cproductNum": 7691, "thkproductNum": 145, "gproductNum": 815, "shopNum": 1007, "tshopNum": 38, "cshopNum": 786, "thkshopNum": 14, "gshopNum": 169 }, { "id": "-1\u00012017-11-13 00:00:00\u0001new balance", "date": "2017-11-13 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 9215, "tsellAmount": 6362, "csellAmount": 2658, "thksellAmount": 58, "gsellAmount": 137, "monthSellAmount": 1045768, "monthTSellAmount": 999192, "monthCSellAmount": 41765, "monthThkSellAmount": 605, "monthGSellAmount": 4206, "sellMoney": 3275280.46, "tsellMoney": 1797430.12, "csellMoney": 1366121.56, "thksellMoney": 44202.78, "gsellMoney": 67526.0, "monthSellMoney": 3.2141010005E8, "monthTSellMoney": 2.9871090185E8, "monthCSellMoney": 2.021690016E7, "monthThkSellMoney": 370681.25, "monthGSellMoney": 2111616.79, "productNum": 9691, "tproductNum": 1920, "cproductNum": 6869, "thkproductNum": 132, "gproductNum": 770, "shopNum": 965, "tshopNum": 39, "cshopNum": 750, "thkshopNum": 14, "gshopNum": 162 }, { "id": "-1\u00012017-11-14 00:00:00\u0001new balance", "date": "2017-11-14 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 7938, "tsellAmount": 5666, "csellAmount": 2106, "thksellAmount": 43, "gsellAmount": 123, "monthSellAmount": 1044866, "monthTSellAmount": 999162, "monthCSellAmount": 41070, "monthThkSellAmount": 619, "monthGSellAmount": 4015, "sellMoney": 2860886.55, "tsellMoney": 1607324.02, "csellMoney": 1150978.13, "thksellMoney": 29224.0, "gsellMoney": 73360.4, "monthSellMoney": 3.2118297293E8, "monthTSellMoney": 2.987337164E8, "monthCSellMoney": 2.000974756E7, "monthThkSellMoney": 389365.37, "monthGSellMoney": 2050143.6, "productNum": 9551, "tproductNum": 1916, "cproductNum": 6772, "thkproductNum": 130, "gproductNum": 733, "shopNum": 949, "tshopNum": 39, "cshopNum": 742, "thkshopNum": 14, "gshopNum": 154 }, { "id": "-1\u00012017-11-15 00:00:00\u0001new balance", "date": "2017-11-15 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 3219, "tsellAmount": 1168, "csellAmount": 1907, "thksellAmount": 19, "gsellAmount": 125, "monthSellAmount": 1042791, "monthTSellAmount": 999083, "monthCSellAmount": 39149, "monthThkSellAmount": 640, "monthGSellAmount": 3919, "sellMoney": 1595154.79, "tsellMoney": 439135.34, "csellMoney": 1079352.45, "thksellMoney": 10141.0, "gsellMoney": 66526.0, "monthSellMoney": 3.2047890037E8, "monthTSellMoney": 2.9871001358E8, "monthCSellMoney": 1.936825017E7, "monthThkSellMoney": 389691.43, "monthGSellMoney": 2010945.19, "productNum": 9383, "tproductNum": 1894, "cproductNum": 6644, "thkproductNum": 136, "gproductNum": 709, "shopNum": 941, "tshopNum": 39, "cshopNum": 737, "thkshopNum": 14, "gshopNum": 151 }, { "id": "-1\u00012017-11-16 00:00:00\u0001new balance", "date": "2017-11-16 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 3355, "tsellAmount": 1709, "csellAmount": 1506, "thksellAmount": 32, "gsellAmount": 108, "monthSellAmount": 1042830, "monthTSellAmount": 999511, "monthCSellAmount": 38726, "monthThkSellAmount": 661, "monthGSellAmount": 3932, "sellMoney": 1453355.7, "tsellMoney": 569257.67, "csellMoney": 809071.04, "thksellMoney": 18438.99, "gsellMoney": 56588.0, "monthSellMoney": 3.2047544362E8, "monthTSellMoney": 2.9883865364E8, "monthCSellMoney": 1.92140092E7, "monthThkSellMoney": 408658.19, "monthGSellMoney": 2014122.59, "productNum": 9261, "tproductNum": 1878, "cproductNum": 6546, "thkproductNum": 135, "gproductNum": 702, "shopNum": 931, "tshopNum": 39, "cshopNum": 729, "thkshopNum": 14, "gshopNum": 149 }, { "id": "-1\u00012017-11-17 00:00:00\u0001new balance", "date": "2017-11-17 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 3344, "tsellAmount": 1744, "csellAmount": 1453, "thksellAmount": 30, "gsellAmount": 117, "monthSellAmount": 1046654, "monthTSellAmount": 1003905, "monthCSellAmount": 38443, "monthThkSellAmount": 662, "monthGSellAmount": 3644, "sellMoney": 1451000.96, "tsellMoney": 582386.07, "csellMoney": 785363.3, "thksellMoney": 18847.99, "gsellMoney": 64403.6, "monthSellMoney": 3.2047359509E8, "monthTSellMoney": 2.9905835654E8, "monthCSellMoney": 1.914118029E7, "monthThkSellMoney": 412099.27, "monthGSellMoney": 1861958.99, "productNum": 9191, "tproductNum": 1894, "cproductNum": 6474, "thkproductNum": 132, "gproductNum": 691, "shopNum": 930, "tshopNum": 39, "cshopNum": 728, "thkshopNum": 14, "gshopNum": 149 }, { "id": "-1\u00012017-11-18 00:00:00\u0001new balance", "date": "2017-11-18 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2791, "tsellAmount": 930, "csellAmount": 1658, "thksellAmount": 55, "gsellAmount": 148, "monthSellAmount": 1042806, "monthTSellAmount": 1001039, "monthCSellAmount": 37470, "monthThkSellAmount": 686, "monthGSellAmount": 3611, "sellMoney": 1437193.7, "tsellMoney": 378639.25, "csellMoney": 957027.45, "thksellMoney": 30779.0, "gsellMoney": 70748.0, "monthSellMoney": 3.2002006403E8, "monthTSellMoney": 2.9902872856E8, "monthCSellMoney": 1.871083001E7, "monthThkSellMoney": 423316.67, "monthGSellMoney": 1857188.79, "productNum": 9069, "tproductNum": 1883, "cproductNum": 6386, "thkproductNum": 131, "gproductNum": 669, "shopNum": 925, "tshopNum": 39, "cshopNum": 725, "thkshopNum": 14, "gshopNum": 147 }, { "id": "-1\u00012017-11-19 00:00:00\u0001new balance", "date": "2017-11-19 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2847, "tsellAmount": 651, "csellAmount": 2018, "thksellAmount": 39, "gsellAmount": 139, "monthSellAmount": 1043032, "monthTSellAmount": 1001070, "monthCSellAmount": 37649, "monthThkSellAmount": 695, "monthGSellAmount": 3618, "sellMoney": 1551835.43, "tsellMoney": 274177.25, "csellMoney": 1179525.18, "thksellMoney": 22030.0, "gsellMoney": 76103.0, "monthSellMoney": 3.2023965403E8, "monthTSellMoney": 2.9905485281E8, "monthCSellMoney": 1.888779469E7, "monthThkSellMoney": 425638.67, "monthGSellMoney": 1871367.86, "productNum": 8995, "tproductNum": 1863, "cproductNum": 6351, "thkproductNum": 130, "gproductNum": 651, "shopNum": 918, "tshopNum": 39, "cshopNum": 722, "thkshopNum": 14, "gshopNum": 143 }, { "id": "-1\u00012017-11-20 00:00:00\u0001new balance", "date": "2017-11-20 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2217, "tsellAmount": 406, "csellAmount": 1618, "thksellAmount": 65, "gsellAmount": 128, "monthSellAmount": 1042936, "monthTSellAmount": 1001100, "monthCSellAmount": 37515, "monthThkSellAmount": 720, "monthGSellAmount": 3601, "sellMoney": 1265201.69, "tsellMoney": 189866.3, "csellMoney": 965801.39, "thksellMoney": 41791.0, "gsellMoney": 67743.0, "monthSellMoney": 3.2047977104E8, "monthTSellMoney": 2.9907628807E8, "monthCSellMoney": 1.910010207E7, "monthThkSellMoney": 437826.04, "monthGSellMoney": 1865554.86, "productNum": 8824, "tproductNum": 1856, "cproductNum": 6188, "thkproductNum": 133, "gproductNum": 647, "shopNum": 905, "tshopNum": 39, "cshopNum": 709, "thkshopNum": 14, "gshopNum": 143 }, { "id": "-1\u00012017-11-21 00:00:00\u0001new balance", "date": "2017-11-21 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2157, "tsellAmount": 498, "csellAmount": 1505, "thksellAmount": 43, "gsellAmount": 111, "monthSellAmount": 1090496, "monthTSellAmount": 1048787, "monthCSellAmount": 37418, "monthThkSellAmount": 733, "monthGSellAmount": 3558, "sellMoney": 1106244.46, "tsellMoney": 140887.5, "csellMoney": 884744.28, "thksellMoney": 23863.0, "gsellMoney": 56749.68, "monthSellMoney": 3.2371131727E8, "monthTSellMoney": 3.0231250546E8, "monthCSellMoney": 1.910629987E7, "monthThkSellMoney": 443577.28, "monthGSellMoney": 1848934.66, "productNum": 8747, "tproductNum": 1847, "cproductNum": 6149, "thkproductNum": 125, "gproductNum": 626, "shopNum": 900, "tshopNum": 37, "cshopNum": 708, "thkshopNum": 13, "gshopNum": 142 }, { "id": "-1\u00012017-11-22 00:00:00\u0001new balance", "date": "2017-11-22 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2315, "tsellAmount": 849, "csellAmount": 1323, "thksellAmount": 22, "gsellAmount": 121, "monthSellAmount": 1086832, "monthTSellAmount": 1045265, "monthCSellAmount": 37295, "monthThkSellAmount": 747, "monthGSellAmount": 3525, "sellMoney": 1111987.12, "tsellMoney": 266614.8, "csellMoney": 767613.32, "thksellMoney": 11858.0, "gsellMoney": 65901.0, "monthSellMoney": 3.2197914747E8, "monthTSellMoney": 3.0053186424E8, "monthCSellMoney": 1.913053897E7, "monthThkSellMoney": 477969.6, "monthGSellMoney": 1838774.66, "productNum": 8739, "tproductNum": 1848, "cproductNum": 6158, "thkproductNum": 123, "gproductNum": 610, "shopNum": 901, "tshopNum": 39, "cshopNum": 707, "thkshopNum": 13, "gshopNum": 142 }, { "id": "-1\u00012017-11-23 00:00:00\u0001new balance", "date": "2017-11-23 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 1783, "tsellAmount": 384, "csellAmount": 1295, "thksellAmount": 34, "gsellAmount": 70, "monthSellAmount": 1085632, "monthTSellAmount": 1044398, "monthCSellAmount": 36880, "monthThkSellAmount": 733, "monthGSellAmount": 3621, "sellMoney": 1026296.52, "tsellMoney": 167735.5, "csellMoney": 797946.02, "thksellMoney": 20029.0, "gsellMoney": 40586.0, "monthSellMoney": 3.2212777106E8, "monthTSellMoney": 3.0043022247E8, "monthCSellMoney": 1.934726223E7, "monthThkSellMoney": 447717.16, "monthGSellMoney": 1902569.2, "productNum": 8596, "tproductNum": 1838, "cproductNum": 6048, "thkproductNum": 115, "gproductNum": 595, "shopNum": 882, "tshopNum": 38, "cshopNum": 690, "thkshopNum": 13, "gshopNum": 141 }, { "id": "-1\u00012017-11-24 00:00:00\u0001new balance", "date": "2017-11-24 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2128, "tsellAmount": 788, "csellAmount": 1137, "thksellAmount": 118, "gsellAmount": 85, "monthSellAmount": 1041200, "monthTSellAmount": 1000349, "monthCSellAmount": 36584, "monthThkSellAmount": 777, "monthGSellAmount": 3490, "sellMoney": 1137393.42, "tsellMoney": 363600.35, "csellMoney": 661302.07, "thksellMoney": 67966.0, "gsellMoney": 44525.0, "monthSellMoney": 3.2074518458E8, "monthTSellMoney": 2.991586873E8, "monthCSellMoney": 1.928760702E7, "monthThkSellMoney": 467774.96, "monthGSellMoney": 1831115.3, "productNum": 8478, "tproductNum": 1816, "cproductNum": 5960, "thkproductNum": 121, "gproductNum": 581, "shopNum": 870, "tshopNum": 37, "cshopNum": 680, "thkshopNum": 13, "gshopNum": 140 }, { "id": "-1\u00012017-11-25 00:00:00\u0001new balance", "date": "2017-11-25 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 1992, "tsellAmount": 633, "csellAmount": 1197, "thksellAmount": 67, "gsellAmount": 95, "monthSellAmount": 1041209, "monthTSellAmount": 1000521, "monthCSellAmount": 36287, "monthThkSellAmount": 909, "monthGSellAmount": 3492, "sellMoney": 1052426.08, "tsellMoney": 269473.2, "csellMoney": 703156.88, "thksellMoney": 30612.0, "gsellMoney": 49184.0, "monthSellMoney": 3.2085402353E8, "monthTSellMoney": 2.992364978E8, "monthCSellMoney": 1.92651715E7, "monthThkSellMoney": 529291.93, "monthGSellMoney": 1823062.3, "productNum": 8409, "tproductNum": 1827, "cproductNum": 5874, "thkproductNum": 132, "gproductNum": 576, "shopNum": 864, "tshopNum": 37, "cshopNum": 674, "thkshopNum": 14, "gshopNum": 139 }, { "id": "-1\u00012017-11-26 00:00:00\u0001new balance", "date": "2017-11-26 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 4681, "tsellAmount": 3020, "csellAmount": 1461, "thksellAmount": 87, "gsellAmount": 113, "monthSellAmount": 1041384, "monthTSellAmount": 1000663, "monthCSellAmount": 36259, "monthThkSellAmount": 968, "monthGSellAmount": 3494, "sellMoney": 2046726.41, "tsellMoney": 1087159.4, "csellMoney": 848813.03, "thksellMoney": 50476.98, "gsellMoney": 60277.0, "monthSellMoney": 3.2113347201E8, "monthTSellMoney": 2.992653607E8, "monthCSellMoney": 1.943809461E7, "monthThkSellMoney": 605667.84, "monthGSellMoney": 1824348.86, "productNum": 8316, "tproductNum": 1810, "cproductNum": 5812, "thkproductNum": 132, "gproductNum": 562, "shopNum": 850, "tshopNum": 37, "cshopNum": 661, "thkshopNum": 14, "gshopNum": 138 }, { "id": "-1\u00012017-11-27 00:00:00\u0001new balance", "date": "2017-11-27 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 16829, "tsellAmount": 15470, "csellAmount": 1252, "thksellAmount": 13, "gsellAmount": 94, "monthSellAmount": 1041675, "monthTSellAmount": 1001584, "monthCSellAmount": 35672, "monthThkSellAmount": 988, "monthGSellAmount": 3431, "sellMoney": 4943073.14, "tsellMoney": 4176372.5, "csellMoney": 718515.66, "thksellMoney": 6989.98, "gsellMoney": 41195.0, "monthSellMoney": 3.2132467096E8, "monthTSellMoney": 2.9955896645E8, "monthCSellMoney": 1.936455632E7, "monthThkSellMoney": 614818.83, "monthGSellMoney": 1786329.36, "productNum": 8243, "tproductNum": 1812, "cproductNum": 5753, "thkproductNum": 130, "gproductNum": 548, "shopNum": 838, "tshopNum": 36, "cshopNum": 654, "thkshopNum": 14, "gshopNum": 134 }, { "id": "-1\u00012017-11-28 00:00:00\u0001new balance", "date": "2017-11-28 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 7324, "tsellAmount": 6066, "csellAmount": 1157, "thksellAmount": 8, "gsellAmount": 93, "monthSellAmount": 1041649, "monthTSellAmount": 1001862, "monthCSellAmount": 35342, "monthThkSellAmount": 1065, "monthGSellAmount": 3380, "sellMoney": 2421668.82, "tsellMoney": 1700842.4, "csellMoney": 666288.42, "thksellMoney": 5449.0, "gsellMoney": 49089.0, "monthSellMoney": 3.213137927E8, "monthTSellMoney": 2.9963733765E8, "monthCSellMoney": 1.927226385E7, "monthThkSellMoney": 648575.84, "monthGSellMoney": 1755615.36, "productNum": 8193, "tproductNum": 1817, "cproductNum": 5698, "thkproductNum": 137, "gproductNum": 541, "shopNum": 826, "tshopNum": 36, "cshopNum": 644, "thkshopNum": 14, "gshopNum": 132 }, { "id": "-1\u00012017-11-29 00:00:00\u0001new balance", "date": "2017-11-29 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 8140, "tsellAmount": 6998, "csellAmount": 1045, "thksellAmount": 19, "gsellAmount": 78, "monthSellAmount": 1041009, "monthTSellAmount": 1002412, "monthCSellAmount": 34589, "monthThkSellAmount": 1069, "monthGSellAmount": 2939, "sellMoney": 2561508.49, "tsellMoney": 1924603.5, "csellMoney": 583071.0, "thksellMoney": 11814.99, "gsellMoney": 42019.0, "monthSellMoney": 3.2105061091E8, "monthTSellMoney": 2.9982158515E8, "monthCSellMoney": 1.899932636E7, "monthThkSellMoney": 647636.84, "monthGSellMoney": 1582062.56, "productNum": 8101, "tproductNum": 1804, "cproductNum": 5627, "thkproductNum": 136, "gproductNum": 534, "shopNum": 818, "tshopNum": 35, "cshopNum": 639, "thkshopNum": 14, "gshopNum": 130 }, { "id": "-1\u00012017-11-30 00:00:00\u0001new balance", "date": "2017-11-30 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 3315, "tsellAmount": 2172, "csellAmount": 1052, "thksellAmount": 7, "gsellAmount": 84, "monthSellAmount": 1044080, "monthTSellAmount": 1005934, "monthCSellAmount": 34214, "monthThkSellAmount": 1060, "monthGSellAmount": 2872, "sellMoney": 1293939.98, "tsellMoney": 657558.35, "csellMoney": 584967.63, "thksellMoney": 5005.0, "gsellMoney": 46409.0, "monthSellMoney": 3.2165963871E8, "monthTSellMoney": 3.0061274075E8, "monthCSellMoney": 1.886171437E7, "monthThkSellMoney": 642034.83, "monthGSellMoney": 1543148.76, "productNum": 8032, "tproductNum": 1808, "cproductNum": 5571, "thkproductNum": 132, "gproductNum": 521, "shopNum": 812, "tshopNum": 35, "cshopNum": 635, "thkshopNum": 14, "gshopNum": 128 }, { "id": "-1\u00012017-12-01 00:00:00\u0001new balance", "date": "2017-12-01 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 1947, "tsellAmount": 954, "csellAmount": 898, "thksellAmount": 15, "gsellAmount": 80, "monthSellAmount": 1046566, "monthTSellAmount": 1009348, "monthCSellAmount": 33334, "monthThkSellAmount": 1053, "monthGSellAmount": 2831, "sellMoney": 872353.8, "tsellMoney": 317376.5, "csellMoney": 502665.3, "thksellMoney": 6898.0, "gsellMoney": 45414.0, "monthSellMoney": 3.2098611648E8, "monthTSellMoney": 3.0025326105E8, "monthCSellMoney": 1.857878174E7, "monthThkSellMoney": 632295.13, "monthGSellMoney": 1521778.56, "productNum": 7706, "tproductNum": 1798, "cproductNum": 5281, "thkproductNum": 127, "gproductNum": 500, "shopNum": 794, "tshopNum": 35, "cshopNum": 619, "thkshopNum": 14, "gshopNum": 126 }, { "id": "-1\u00012017-12-02 00:00:00\u0001new balance", "date": "2017-12-02 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 2191, "tsellAmount": 1086, "csellAmount": 1012, "thksellAmount": 19, "gsellAmount": 74, "monthSellAmount": 1039118, "monthTSellAmount": 1002406, "monthCSellAmount": 32940, "monthThkSellAmount": 1061, "monthGSellAmount": 2711, "sellMoney": 996348.57, "tsellMoney": 378055.65, "csellMoney": 571850.92, "thksellMoney": 10135.0, "gsellMoney": 36307.0, "monthSellMoney": 3.206242885E8, "monthTSellMoney": 3.0002442155E8, "monthCSellMoney": 1.851312136E7, "monthThkSellMoney": 634921.13, "monthGSellMoney": 1451824.46, "productNum": 7580, "tproductNum": 1794, "cproductNum": 5174, "thkproductNum": 126, "gproductNum": 486, "shopNum": 781, "tshopNum": 35, "cshopNum": 609, "thkshopNum": 13, "gshopNum": 124 }, { "id": "-1\u00012017-12-03 00:00:00\u0001new balance", "date": "2017-12-03 00:00:00", "categoryId": "-1", "categoryName": null, "categoryLevel": 0, "brandName": "new balance", "sellAmount": 5569, "tsellAmount": 4215, "csellAmount": 1263, "thksellAmount": 21, "gsellAmount": 70, "monthSellAmount": 1039095, "monthTSellAmount": 1002582, "monthCSellAmount": 32778, "monthThkSellAmount": 1068, "monthGSellAmount": 2667, "sellMoney": 1834940.19, "tsellMoney": 1077847.05, "csellMoney": 706854.14, "thksellMoney": 9906.0, "gsellMoney": 40333.0, "monthSellMoney": 3.2061178074E8, "monthTSellMoney": 3.001081916E8, "monthCSellMoney": 1.844366248E7, "monthThkSellMoney": 637228.6, "monthGSellMoney": 1422698.06, "productNum": 7465, "tproductNum": 1787, "cproductNum": 5068, "thkproductNum": 127, "gproductNum": 483, "shopNum": 765, "tshopNum": 35, "cshopNum": 596, "thkshopNum": 12, "gshopNum": 122 }] };

    this.vm.data = res.data;

    // 合计
    this.sellResulet = this.util.getSellAllResult(this.sellResulet, res.data);

    setTimeout(() => {
      this.vm.loading = false;
    }, 100);

  }



}
